import pygame,os,datetime
from pygame.locals import *

import lib.ANNClass
from lib.ANNScreen import screen
from lib.ANNActions import _actions_
from lib.ANNBody import _body_
from lib.ANNLocation import _places_


___clock = pygame.time.Clock()

_file_name = 'memory/ANN_Memory-'

_ANN_Objects = []
_num_ = 5
for x in range(_num_):
    memory_file = open(_file_name+'%s.memory' % x,'r')
    ANN = lib.ANNClass.ANN(memory_file)
    _ANN_Objects.append(ANN)

running = 1
while running:
    screen.fill((10,10,10))
    ___clock.tick(30)
    for ANN in _ANN_Objects:
        ANN.Update()

    pygame.display.flip()
    for event in pygame.event.get():
        if event.type == QUIT:
            running = 0
        if event.type == KEYDOWN:
            if event.key == K_ESCAPE:
                running = 0

pygame.quit()
fn = 0
for ANN in _ANN_Objects:
    filename = _file_name+'%s.memory' % fn
    ANN.__save__(filename)
    fn+=1

